﻿using System;
using Microsoft.Xna.Framework.Input;

namespace CsharpPoker.Core
{
    /// <summary>
    /// a temporary class that handles some basic input patterns. This will be refactored into a real 
    /// input handler and input utility framework. We will look for free one online :D I don't think any of 
    /// wants to write an input handler, lol. -abomb
    /// </summary>
    public class Input
    {
        // Used for handle input
        protected KeyboardState oldKeyboardState;

        public Input()
        {
            // Used for input handling
            oldKeyboardState = Keyboard.GetState();
        }

        /// <summary>
        /// Check if the Enter Key has been pressed3
        /// </summary>
        /// <returns>true, if enter key was pressed</returns>
        public bool CheckEnter()
        {
            // Get the Keyboard
            KeyboardState keyboardState = Keyboard.GetState();

            bool result = (oldKeyboardState.IsKeyDown(Keys.Enter) &&
                          (keyboardState.IsKeyUp(Keys.Enter)));

            oldKeyboardState = keyboardState;

            return result;
        }

    }
}